

//运用useRef作为稳定的定时器
import {useEffect, useRef} from "react";

const NotFound = () => {
  const timer =useRef<  NodeJS.Timeout | undefined>(undefined)

  useEffect(()=>{
    timer.current =setInterval(()=>{
      console.log("刷新页面")
    },1000)

    return ()=>{
      //清除定时器
      clearInterval(timer.current)
    }
  },[])
  return (
    <div>NotFound</div>
  );
};

export default NotFound;